package com.example.demo.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.example.demo.custom.BaseRepository;
import com.example.demo.entity.MoneyCompany;
import com.example.demo.entity.MoneyCompany2;

@Repository
public interface MoneyCompany2Repository extends BaseRepository<MoneyCompany2,Integer> {

	List<MoneyCompany2> findByMoney(MoneyCompany money);

	/**
	 * @param car
	 * @return 通过时间排序得到最新一条
	 */
	@Query(value = "SELECT  *  FROM money_company2 t WHERE t.money_id=? ORDER BY t.begin_date DESC LIMIT 1 ",nativeQuery=true)
	MoneyCompany2 findByMoney2(Integer id);

}
